<template>
	<view>
		<wfalls-flow :list="list" ref="wfalls"></wfalls-flow>
	</view>
</template>

<script>
    import wfallsFlow from '@/components/wfalls-flow/wfalls-flow'
    const list = require('@/static/wfalls-flow/data.json').list
	export default {
        components:{
            wfallsFlow
        },
		data() {
			return {
				list,
			}
		},
        onReachBottom() {
            uni.showLoading({title:'正在加载更多'})
            // 模拟分页请求 (加载更多)
            setTimeout(()=>{
                const nextData = JSON.parse(JSON.stringify(this.list.slice(0,10)))
                this.list.push(...nextData);
                this.$refs.wfalls.handleViewRender();
                uni.hideLoading()
            },800)
        },
        onPullDownRefresh() {
            // 模拟更新新数据
            const newData = JSON.parse(JSON.stringify(this.list.slice(0,10)))
            setTimeout(()=>{
                this.list = newData;
                this.$refs.wfalls.init();
                this.$nextTick(function(){
                    this.$refs.wfalls.handleViewRender();
                })
                uni.stopPullDownRefresh()
                uni.showToast({title:'刷新成功',icon:'none'})
            },800)
        }
	}
</script>
